package com.miracle.blog.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.miracle.blog.dto.ArticleBackDTO;
import com.miracle.blog.dto.ArticleHomeDTO;
import com.miracle.blog.dto.ArticlePreviewDTO;
import com.miracle.blog.dto.ArticleStatisticsDTO;
import com.miracle.blog.entity.Article;
import com.miracle.blog.vo.ConditionVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface ArticleDao extends BaseMapper<Article> {
    List<ArticleStatisticsDTO> listArticleStatistics();

    Integer countArticleBacks(@Param("condition") ConditionVO conditionVO);

    List<ArticleBackDTO> listArticleBacks(@Param("current") Long current, @Param("size") Long size, @Param("condition") ConditionVO condition);

    List<ArticleHomeDTO> listArticles(@Param("current") Long current, @Param("size") Long size);

    /**
     * 根据条件查询文章
     *
     * @param current   页码
     * @param size      大小
     * @param condition 条件
     * @return 文章列表
     */
    List<ArticlePreviewDTO> listArticlesByCondition(@Param("current") Long current, @Param("size") Long size, @Param("condition") ConditionVO condition);
}
